package cn.topcodes.tcsf.admin.domain.entity;

import cn.topcodes.tcsf.admin.commons.domain.IdEntity;
import cn.topcodes.tcsf.admin.commons.generic.OperateLogConfig;
import lombok.Data;
import lombok.ToString;

import javax.persistence.Table;

/**
 *  系统权限
 *  @author unicorn
 */
@Data
@ToString(callSuper = true)
@OperateLogConfig(name = "系统权限")
@Table(name = "t_sys_permission")
public class SysPerm extends IdEntity implements Comparable<SysPerm> {

    private static final long serialVersionUID = 1L;

    /*权限名称*/
    private String name;

    /*描述*/
    private String description;

    /*权限代码*/
    private String code;

    private Long parentId;

    private Integer sort;

    @Override
    public int compareTo(SysPerm o) {
        if(o != null) {
            if(o.sort == null) {
                return -1;
            }else if(this.sort == null) {
                return 1;
            }
            return this.sort - o.sort;
        }
        return 0;
    }
}